<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>for 遍历数组</title>
    <style>
        ul{
            list-style-type: none;
            width: auto;
            margin: 0 auto;
        }
    </style>
</head>
<body>
<div id="app">
    <!--  直接显示整个数组内容  -->
    <div>{{ nameList }}</div>
    <br>
    <!--  显示指定的数组元素  -->
    <div>{{ nameList[0] }}</div>
    <div>{{ nameList[1] }}</div>
    <div>{{ nameList[2] }}</div>
    <div>{{ nameList[3] }}</div>
    <br>
    <!--  显示指定的数组元素——循环写法  -->
    <div v-for="name in nameList">{{  name }}</div>


    <ol>
        <li v-for="name in nameList">{{ name }}</li>
    </ol>

    <ul>
        <li v-for="(name, index) in nameList">{{ index }}. {{ name }}</li>
    </ul>



</div>

<script src="../../../../../js/vue.global.js"></script>
<script>
    const app = Vue.createApp({
        data() {
            return {
                nameList: ["Jim", "James", "Kevin", "Kobe"]
            }
        },
        methods: {}
    })

    app.mount("#app")
</script>
</body>
</html>